Skip to content

Add command (API-dispatch) backend to oz-agent-worker#90

Merged
captainsafia merged 6 commits into
mainfrom
zb/command-backend
Jul 22, 2026
Merged

Add command (API-dispatch) backend to oz-agent-worker#90
captainsafia merged 6 commits into
mainfrom
zb/command-backend

Conversation

@zachbai

@zachbai zachbai commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Introduce a transport-agnostic command backend that delegates task execution to an operator-configured dispatch command (fire-and-forget). The worker renders a versioned JSON dispatch payload to the command's stdin; on success it suppresses its own terminal completion so the remote oz agent reports terminal state to warp-server itself, and routes cancellations to an optional cancel command. Includes config/CLI wiring, unit + integration tests, README docs, and an HTTP REST reference dispatch script.

Co-Authored-By: Oz oz-agent@warp.dev

zachbai commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@zachbai
zachbai force-pushed the zb/command-backend branch from 27c1ca8 to 545822c Compare June 24, 2026 23:19
@bnavetta

Copy link
Copy Markdown
Collaborator

Updated with a couple changes:

  • TASK_ID -> RUN_ID throughout
  • Backends now return an ExecuteResult struct that carries the outcome (completed, fire-and-forget, or failure) and the error, instead of a sentinel error for fire-and-forget
  • All backends support an explicit cancellation API, so we don't need to separately track fire-and-forget executions
  • Documented the requirement that implementations call oz harness-support report-shutdown, and updated examples to do so

@bnavetta
bnavetta force-pushed the zb/command-backend branch from 734f270 to 65d397a Compare July 22, 2026 13:52
zachbai and others added 3 commits July 22, 2026 14:52
Introduce a transport-agnostic `command` backend that delegates task execution to an operator-configured dispatch command (fire-and-forget). The worker renders a versioned JSON dispatch payload to the command's stdin; on success it suppresses its own terminal completion so the remote oz agent reports terminal state to warp-server itself, and routes cancellations to an optional cancel command. Includes config/CLI wiring, unit + integration tests, README docs, and an HTTP REST reference dispatch script.

Co-Authored-By: Oz <oz-agent@warp.dev>
Adds a real-run reference dispatch command for local end-to-end testing: it logs/persists the forwarded DispatchPayload and launches the oz agent for real via base_args (fire-and-forget), so the command backend can be exercised against a local warp-server + session-sharing-server + oz-agent-worker (e.g. via warp-server's script/oz-local --worker-backend command). Includes CI-verified tests and README docs.

Co-Authored-By: Oz <oz-agent@warp.dev>
@bnavetta
bnavetta force-pushed the zb/command-backend branch from 65d397a to 6e0bf79 Compare July 22, 2026 14:55
@bnavetta
bnavetta marked this pull request as ready for review July 22, 2026 14:55
captainsafia and others added 3 commits July 22, 2026 19:19
Tests for TestExecuteTaskAppliesInstanceShape, TestExecuteTaskDeletesJobOnSuccess,
and TestExecuteTaskPreservesJobOnFailure were still using the old error return
pattern but ExecuteTask now returns ExecuteResult.

Co-Authored-By: Oz <oz-agent@warp.dev>
…mandEnv

mergeEnvVars uses last-wins semantics within the override slice. Previously,
wellKnown vars were prepended before config.Env entries, so an operator setting
OZ_RUN_ID, OZ_EXECUTION_ID, or OZ_WORKER_BACKEND in their Env map would
silently override the actual task values.

Fix: append config.Env first, well-known vars last, so worker-set identifiers
always take precedence. Add a test to lock in this invariant.

Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
@captainsafia
captainsafia merged commit 5c1eb89 into main Jul 22, 2026
8 checks passed
@captainsafia
captainsafia deleted the zb/command-backend branch July 22, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants